<template>
	<view>
		<view class="u-p-20 ">
			<view class="bg_FFFFFF u-p-20  u-b-r-16" v-for="(item,index) in list" :key="index" @click="afterUrl(item)">
				<view class="u-p-20 u-flex u-row-between" style="border-bottom: 1rpx solid #F4F1F1;">
					<view class="u-flex">
						<view class="u-h-36">
							<u-image src='https://www.sqkjkj.vip/wxImg/orderlist/img1.png' width='36rpx' height='36rpx'></u-image>
						</view>
						<view class="u-p-l-10 u-weight u-h-36">{{item.shop_name}}</view>
						<view class="u-p-l-20 u-h-36">
							<u-image src='https://www.sqkjkj.vip/wxImg/orderlist/img2.png' width='20rpx' height='20rpx'></u-image>
						</view>
					</view>
					
					<view class=""  style="color: #FC3533;">{{item.status_title}}</view>
					
				</view>
		
				<view class="u-p-20 u-flex u-row-between" style="border-bottom: 1rpx solid #F4F1F1;"
					v-for="(items,indexs) in item.order_item" :key="indexs">
					<view class="u-flex">
						<view class="">
							<u-image :src='items.imgs[0]' width='183rpx' height='183rpx'></u-image>
						</view>
						<view class="u-p-l-10 ">
							<view class="u-weight">{{items.goods_name}}</view>
							<!-- <view class="u-weight u-p-t-10">可口30克*12枚</view> -->
							<view class="u-font-20  u-m-t-10"
								style="">
								{{items.spece_value_title}}
							</view>
							<view class=" u-p-t-10" style="color: #FC3533;">￥{{items.price}}</view>
						</view>
		
					</view>
					<view class="u-font-20" style="color:#454545;">{{items.num}}</view>
				</view>
		
				<view class="u-p-20">
					<view class="" style="color: #FC3533;text-align: right;">合计:￥{{item.total_amount}}</view>
				</view>
			</view>
		</view>
		
		
		
		<!-- 加载更多 -->
		<u-loadmore :status="status" icon-type="circle" margin-bottom="20" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				params: {
					page: 1,
					page_size: 20,
				},
				status: 'loadmore',
			}
		},
		// 下拉到底事件
		onReachBottom() {
			//避免多次触发
			if (this.status == 'loading' || this.status == 'nomore') {
				return;
			}
			if(this.list.length>20){
				this.refund_list();
			}
		},
		onShow() {
			this.clear()
			this.refund_list()
		},
		methods: {
			clear() {
				this.list = [];
				this.params.page = 1;
			},
			// 获取商品列表
			async refund_list() {
				await this.$api.refund_list(this.params, res => {
					if (res.data.code == 1) {
						if (res.data.data.data.length < 20) {
							this.status = 'nomore';
						} else {
							this.params.page = this.params.page + 1;
							this.status = 'loadmore';
						}
						this.list = this.list.concat(res.data.data.data);
						uni.stopPullDownRefresh();
					}
				})
			},
			afterUrl(item){
				uni.setStorageSync('afterDetail',item)
				this.$u.route(`/subcontract/aftersales/massage/massage?id=${item.id}`)
			}
		}
	}
</script>

<style scoped>
	page {
		background: #f5f5f5;
	}

	.bgc {
		background: #F4F4F4;
	}

	.bgc1 {
		background: #FFF2F2;
		border: 1rpx solid #FC3533;
	}

	.error {
		width: 74rpx;
		height: 160rpx;
		background: url('https://www.sqkjkj.vip/wxImg/common/home/img12.png') no-repeat;
		background-size: 100% 100%;
	}
</style>
